package com.wf.day_0611.test3;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author mpk
 * @since 2024/6/11 17:36:40
 */
public class DateUtils {

 /*   写一个静态方法 ：将字符串解析为日期对象 public static Date parseDate(String string)
    定义一个静态常量：public static final SimpleDateFormat sdf = new SimpleDateFormat("");*/

    public static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/ddHH:mm:ss");

    public static Date parseDate(String s) {

        Date date = new Date();

        try {
            date = sdf.parse(s);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return date;
    }


}
